package com.smarttiger.zero.admin.dao;

import com.smarttiger.zero.admin.entity.BlackListModel;
import com.smarttiger.zero.admin.entity.UsersModel;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public interface BlackListDao extends BaseDao<BlackListModel> {

    public List<BlackListModel> findAllByInterfaceId(String interfaceId);

    @Modifying
    @Query("delete from BlackListModel es where es.interfaceId = ?1")
    public void deleteByInterfaceId(String id);


    @Query("select u from UsersModel u inner join BlackListModel bl on u.id = bl.usersId where bl.interfaceId = ?1 ")
    public List<UsersModel> queryBlackListModelByInterfaceId(String interfaceId);
}
